package com.triplelink.business.impl.rush;

import com.triplelink.business.interfaces.EntityTSManager;
import com.triplelink.context.Connector;
import com.triplelink.context.UserConnector;
import com.triplelink.dao.interfaces.EntityDAO;
import com.triplelink.exception.TripleLinkException;
import com.triplelink.factory.DAOFactory;
import com.triplelink.util.StringUtil;

public abstract class EntityTSManagerRushBase extends UserConnector implements EntityTSManager
{
	private EntityDAO entityDAO;
	
	private String abox;

	public EntityTSManagerRushBase(Connector connector)
	{
		super(connector);
	}
	
	protected EntityDAO getEntityDAO()
	{
		if (entityDAO == null)
			entityDAO = DAOFactory.createEntityDAO(getConnector());
		
		return entityDAO;
	}
	
	public String getAbox() {
		return abox;
	}

	public void setAbox(String abox) {
		this.abox = abox;
	}
	
	protected void validateExistsAbox()
	{
		if (StringUtil.isBlankOrNull(getAbox()))
			throw new TripleLinkException("No abox found in EntityTSManager. You shound set abox before!");
	}
}
